package com.erp.module.xieyi

import android.view.View
import com.erp.R
import com.erp.activity.BaseActivity
import kotlinx.android.synthetic.main.activity_xieyi.*
import kotlinx.android.synthetic.main.activity_xieyi.webview
import kotlinx.android.synthetic.main.header_knoya.view.*

class XieyiActivity : BaseActivity(), View.OnClickListener {

    private var code = 0;
    private var URL = "";
    override fun getLayoutId(): Int {
        return com.erp.R.layout.activity_xieyi
    }

    override fun initCreate() {
        code = intent.getIntExtra("code", code)
        if(code ==1){
            webHerder.tv_header_title.text = "使用协议"
            URL = "<html><body>"+ resources.getString(R.string.user_agreement)+"</body></html>"
        }else if(code ==2){
            webHerder.tv_header_title.text = "隐私政策"
            URL = "<html><body>"+ resources.getString(R.string.privacy_policy)+"</body></html>"
        }

        webHerder.iv_header_left.visibility=View.VISIBLE
        webHerder.iv_header_left.setOnClickListener(this)
        webview.settings.javaScriptEnabled = true
        webview.settings.setSupportZoom(true)
        webview.settings.displayZoomControls = false
        webview.settings.builtInZoomControls = true

        /**
         * 将文本HTML显示在webview中
         */
        webview.loadDataWithBaseURL(null,URL,"text/html","utf-8",null);
    }

    override fun onClick(v: View?) {
        finish()
    }

}
